<?php
/**
 * Pipahr
 * @brief An action to get attachment by id
 *
 * @author Chen Wei
 * @copyright 2013 pipahr.com
 */
OCP\JSON::checkAppEnabled('calendar');

if(!OC_User::isLoggedIn()) {
   jexit(jsonError('您需要先登录', null, false));
}
if (PFactory::isJobseekerUser()) {
   jexit(jsonError('您不是企业用户', null, false));
}
if (!PSession::checkToken('post')) {
   jexit(jsonError('验证已失效，请重新验证', null, false));
}

$attachmentid = JRequest::getInt('attachmentid', 0);
$jobid = JRequest::getInt('jobid',0);

if(!PCompanyHelper::checkJobManagerPermissions($jobid)){
   $this->setError('您沒有操作权限！');
   return false;
}

$listmodel = new PCalendarModellistview();

$attachment = $listmodel->getAttachmentList($attachmentid);

if (count($attachment)<=0) {
   jexit(jsonError('网络异常，请刷新重试！', null, false));
}
jexit(jsonSuccess('信息获取成功', null, null, false));